package com.fanxl.flink.project.domain;

import lombok.Data;
import org.apache.commons.lang3.time.FastDateFormat;
import org.apache.flink.streaming.api.windowing.time.Time;

/**
 * @description:
 * @author: fanxiaole
 * @date: 2022/3/20 16:24
 */
@Data
public class Access {

    public String deviceType;

    public String uid;

    public String os;

    public String ip;

    public int nu;

    public String channel;

    public long time;

    public String event;

    public String net;

    public String device;

    public String version;

    public Product product;

    public String province;

    public String city;

    @Override
    public String toString() {
        return "Access{" +
                "deviceType='" + deviceType + '\'' +
                ", uid='" + uid + '\'' +
                ", os='" + os + '\'' +
                ", ip='" + ip + '\'' +
                ", nu=" + nu +
                ", channel='" + channel + '\'' +
                ", time=" + time +
                ", event='" + event + '\'' +
                ", net='" + net + '\'' +
                ", device='" + device + '\'' +
                ", version='" + version + '\'' +
                ", product=" + product +
                ", province='" + province + '\'' +
                ", city='" + city + '\'' +
                '}';
    }

    public static void main(String[] args) {
        FastDateFormat format = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss");
        // 2022-03-22 13:00:07  [20:00 24:59)
        long time = 1647858283000L;
        // 2022-03-21 18:24:43
        System.out.println("time:" + format.format(time));
        long size = Time.minutes(5).toMilliseconds();
        System.out.println(size);
        long diff = time % size;
        System.out.println(diff);
        System.out.println("start:" + format.format(time - diff));
        //
    }
}
